package com.qianchang.microfinance.view.mine;

import android.os.Bundle;

import com.qianchang.microfinance.R;
import com.qianchang.microfinance.bean.PageBean;
import com.qianchang.microfinance.bean.TradRecordBean;
import com.qianchang.microfinance.bean.UserLoginInfo;
import com.qianchang.microfinance.global.DMApplication;
import com.qianchang.microfinance.utils.DMConstant;
import com.qianchang.microfinance.view.base.BaseRecyclerAdapter;
import com.qianchang.microfinance.view.base.BaseRecyclerViewActivity;
import com.dm.library.http.DMOKHttpUtils;
import com.dm.library.http.HttpParams;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;

public class TradRecordActivity extends BaseRecyclerViewActivity<TradRecordBean> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_trad_record);
        setTitleName(getString(R.string.title_trad_record));
        initView();
        initData();
    }

    @Override
    protected void requestData(HttpParams params) {
        UserLoginInfo userLoginInfo = DMApplication.getInstance().getmUserLoginInfo();
        String usid = userLoginInfo.getUserId();

        params.put("opSource", 1);
        params.put("maxResults", 10);
        params.put("userId", usid);

        DMOKHttpUtils.getInstance().post(this, DMConstant.ApiURL.FIND_ACCOUNT_RECORD, params, mCallBack);
    }

    @Override
    protected BaseRecyclerAdapter getRecyclerAdapter() {
        return new TradRecordAdapter(this);
    }

    @Override
    protected Type getType() {
        return new TypeToken<PageBean<TradRecordBean>>() {
        }.getType();
    }
}
